package com.agan.jvm.controller;



import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author 阿甘
 * @see https://study.163.com/course/introduction/1211562809.htm?share=1&shareId=1028852228
 * @version 1.0
 * 注：如有任何疑问,欢迎加阿甘老师微信agan-java 进行讨论
 */
@RestController
public class Controller {


    @GetMapping(value = "/test")
    public  String test() throws InterruptedException {
        byte[] _1m=new byte[1024];
        Thread.sleep(60*1000);
        return "ok8888888888888888888888888888888888888888afas沙发沙发上撒旦法法师打发上服务器父亲为人服务器而放弃维尔服务器而";
    }



    /**
     * 发送消息
     */
    @GetMapping(value = "/get")
    public  void addClass() {
//        int j = 0;
//        try {
//            OOMTest test = new OOMTest();
//
//            for (int i = 0; i < 1000000; i++) {
//                //创建ClassWriter对象，用于生成类的二进制字节码
//                ClassWriter classWriter = new ClassWriter(0);
//                //指明版本号，修饰符，类名，包名，父类，接口
//                classWriter.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC, "Class" + i, null, "java/lang/Object", null);
//                //返回byte[]
//                byte[] code = classWriter.toByteArray();
//                //类的加载
//                test.defineClass("Class" + i, code, 0, code.length);//Class对象
//                j++;
//            }
//        } finally {
//            System.out.println(j);
//        }
    }


}












